﻿using System;
using System.ComponentModel;

namespace Lasalara.Model
{
    public class Question : IEquatable<Question>, INotifyPropertyChanged
    {
        private string _questionText;
        private string _answerText;
        private double _fontSize;
        public DateTime AnsweredDate { get; set; }
        public int AnswerCount { get; set; }


        public string QuestionText
        {
            get { return _questionText; }
            set
            {
                _questionText = value;
                PropChanged("QuestionText");
            }
        }

        public string AnswerText
        {
            get { return _answerText; }
            set
            {
                _answerText = value;
                PropChanged("AnswerText");
            }
        }
        public double FontSize
        {
            get { return _fontSize; }
            set
            {
                _fontSize = value;
                PropChanged("FontSize");
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        private void PropChanged(string propName)
        {
            if (PropertyChanged != null)
            {
            PropertyChanged( this, new PropertyChangedEventArgs( propName ) );
            }
        }

        #region IEquatable<Question> Members

        /// <summary>
        /// Checks if given chapter equals to the compared chapter
        /// </summary>
        /// /// <param name="other">Given chapter</param>
        public bool Equals(Question other)
        {
            return other != null && QuestionText.Equals(other.QuestionText) && AnswerText.Equals(other.AnswerText);
        }

        #endregion    
    }   
}